[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Function fname_match - compare filenames w/wildcards
Syntax int fname_match(char *fname1, char *fname2);
Prototype in filehk.h
Remarks compares filename fname1 to fname2 with wildcard
matching (*,?). Case is irrelevant.
Return value return a value
< 0 if fname1 is less than fname2
= 0 if fname1 is the same as fname2
> 0 if fname1 is greater than fname2
Note fname_match() compares strings just like DOS does
(or at least DOS 3.2, the one I work under.) Thus:
"STR*.*" = "str*.*"
"str.d*" = "StR.DZ"
"str" = "str.c"
Very little error checking is done. If an invalid
filename is passed (i.e. more than 12 characters
long) unpredictable results may occur.
See also fncmp()
Example #include <filehk.h>
main()
{
char a[12], b[12];
int cmp;
strcpy(a,"stringhk.c");
strcpy(b,"?TRI*");
printf("%s ",a);
if ((cmp = fname_match(a,b)) == 0)
printf("=");
else if (cmp < 0)
printf("<");
else
printf(">");
printf(" %s\n",b);
}
Program output stringhk.c = ?TRI*
See Also:
fncmp()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson